import 'package:flutter/material.dart';

class HistoryPage extends StatelessWidget {
  final List<int> history;

  const HistoryPage({super.key, required this.history});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('计数历史记录')),
      body: ListView.builder(
        itemCount: history.length,
        itemBuilder: (context, index) {
          return Card(
            margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
            child: ListTile(
              leading: const Icon(Icons.history),
              title: Text('记录 ${history.length - index}'),
              subtitle: Text('数值: ${history[index]}'),
              trailing: Text(DateTime.now().toString().substring(0, 16)),
            ),
          );
        },
      ),
    );
  }
}
